package com.wenan.ui.controls.command
{
	import com.wenan.data.ChangeButtonInfo;
	import com.wenan.data.PageInfo;
	import com.wenan.ui.layout.NavigatorPage;
	
	import mx.containers.Canvas;
	
	public class CommandBar extends Canvas
	{
		private var _page:NavigatorPage;
		private var leftBar:LeftCommandBar;
		private var rightBar:RightCommandBar;
		
		public function CommandBar()
		{
			super();
			
			setStyle("verticalAlign", "middle");
			
			height = 35;
			
			initilizeComponents();	
		}

		/**
		 * 所在页面。
		 */
		public function get page():NavigatorPage
		{
			return _page;
		}

		public function set page(value:NavigatorPage):void
		{
			_page = value;
			leftBar.page = value;
			rightBar.page = value;
		}

		/**
		 * 导航页面信息数组。
		 */
		public function get navigatorPageInfos():Array
		{
			return leftBar.navigatorControl.pageInfos;
		}
		
		public function set navigatorPageInfos(value:Array):void
		{
			leftBar.navigatorControl.pageInfos = value;
		}
		
		/**
		 * 统计图表数组。
		 */
		public function get statisticsReports():Array
		{
			return rightBar.statisticsReports;
		}
		
		public function set statisticsReports(value:Array):void
		{
			rightBar.statisticsReports = value;
		}
		
		/**
		 * 界面切换按钮。
		 */
		public function get changeButton():PageInfo
		{
			return rightBar.changeButton;
		}
		
		public function set changeButton(value:PageInfo):void
		{
			rightBar.changeButton = value;
		}
		
		
		/**
		 * 初始化控件。
		 */
		private function initilizeComponents():void
		{
			leftBar = new LeftCommandBar();
			leftBar.left = 2;
			leftBar.percentHeight = 100;
			addElement(leftBar);
			
			rightBar = new RightCommandBar();
			rightBar.right = 2;
			rightBar.percentHeight = 100;
			addElement(rightBar);
		}
	}
}